package com.liliudong.template.common.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 基础Entity
 *
 * @author ldli5
 * @classname BaseEntity
 * @date 2024/6/18-15:28
 */
@Data
public abstract class BaseEntity {
	/**
	 * 主键
	 */
	@TableId(value = "id", type = IdType.ASSIGN_ID)
	protected Long id;

	/**
	 * 创建时间
	 */
	@TableField(value = "created_at", fill = FieldFill.INSERT)
	protected LocalDateTime createdAt;

	/**
	 * 创建人
	 */
	@TableField(value = "created_by", fill = FieldFill.INSERT)
	protected Long createdBy;

	/**
	 * 创建自部门编号
	 */
	@TableField(value = "created_from", fill = FieldFill.INSERT)
	protected String createdFrom;

	/**
	 * 更新时间
	 */
	@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
	protected LocalDateTime updatedAt;

	/**
	 * 更新人
	 */
	@TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
	protected Long updatedBy;

	/**
	 * 逻辑删除字段 0.未删除 1.删除
	 */
	@TableField(value = "deleted")
	protected Integer deleted;
}
